package com.ychs.servlet;

import com.ychs.entity.College;
import com.ychs.entity.Role;
import com.ychs.service.IBaseService;
import com.ychs.service.RoleService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * copyright(c)2021 YYB.ALL rights Reserved
 * <p>
 * 描述:
 *
 * @author 原玉波
 * @version 1.0
 * @date 2021/7/26
 */
@WebServlet(value = "/RoleServlet")
public class RoleServlet extends BaseServlet{
    private IBaseService<Role> service = new RoleService();

    @Override
    protected void search(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        logger.info("enter role search method");

        Map<String, Object> conditions = new HashMap<>();

        //查询数据
        List<Role> roles = service.search(conditions);
        //准备Json
        String json = json(0,roles);
        logger.info(json);
        //把Java字符串输出到前端
        response.getWriter().print(json);
    }
}
